package com.abcd.javabase;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * @program: java-base
 * @description:
 * @author: Liu
 **/
public class IFTest {

    public static void main(String[] args) {

        int a = 10;

        if (a > 20) {
            System.out.println(20);
        } else if (a < 100) {
            System.out.println(100);
        } else if (a < 50) {
            System.out.println(50);
        } else {
            System.out.println(123);
        }
        System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
        System.out.println(Thread.currentThread().getStackTrace()[1].getClassName());
        System.out.println(IFTest.class.getName());

        String clazzName = new SecurityManager() {
            public String getClassName() {
                return getClassContext()[1].getName();

            }

        }.getClassName();

        System.out.println(clazzName);
        String substring = clazzName.substring(clazzName.indexOf("." ));
        System.out.println(substring);
        String sdd = "https://pay-marketing.oss-cn-hangzhou.aliyuncs.com/pay-marketing/common/f4eba61d44319c4410e2e10e8aae8e84/transfer.png";
        System.out.println(sdd.length());

        Calendar c = Calendar.getInstance();
        //过去一年
        c.setTime(new Date());
        c.add(Calendar.YEAR, -2);
        System.out.println(c.getTime());

        String transferImageUrl = "";
        String abc = "123";
        System.out.println(transferImageUrl + abc);


        List<KeyWord> vouchers = new ArrayList<>();

        KeyWord keyWord = new KeyWord();
        keyWord.setAbc(123);
        keyWord.setWww("123");
        KeyWord keyWord1 = new KeyWord();
        keyWord1.setAbc(100);
        vouchers.add(keyWord);
        vouchers.add(keyWord1);

        System.out.println(vouchers);


        String aaaaaa = "123456&76543&21";
        System.out.println(aaaaaa);
        String substring1 = aaaaaa.substring(0, aaaaaa.indexOf("&"));
        System.out.println(substring1);

        System.out.println(aaaaaa.lastIndexOf("&"));

        int w = 1;
        if (w == 1) {
            System.out.println("ww");
        } else if (w == 1){
            System.out.println("bb");
        }

    }
}